<?php

class Admin_Form_Change extends Zend_Form {

    public function init(){
        $this->setName('userFrm');
        // do not need current password if user request reset pass
        if(!$this->_isReset){
            $currentPass = new Zend_Form_Element_Password('currPass');
            $currentPass->setLabel('Password hiện tại')->setRequired(true)->addValidator('NotEmpty');
            $this->addElement($currentPass);
        }

        $newPass = new Zend_Form_Element_Password('newPass');
        $newPass->setLabel('Password mới')->setRequired(true)->addValidator('NotEmpty');

        $confirmPass = new Zend_Form_Element_Password('confirmPass');
        $confirmPass->setLabel('Confirm password')->setRequired(true)->addValidator('Identical',false,array('token' => 'newPass'));
        $confirmPass->addErrorMessage('Password không khớp! ');

        $hash = new Zend_Form_Element_Hash('csrf');

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Đổi mật khẩu');

        $this->addElements(array($newPass,$confirmPass,$hash, $submit));
    }

} 